import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';

export const columns: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
    width: 50,
    align: 'center',
  },
  {
    title: '姓名',
    dataIndex: 'fname',
    width: 100,
    align: 'center',
  },
  {
    title: '工号',
    dataIndex: 'fnumber',
    width: 100,
    align: 'center',
  },
  {
    title: '职称',
    dataIndex: 'type',
    width: 120,
    align: 'center',
  },
  {
    title: '部门',
    dataIndex: 'class',
    width: 180,
    align: 'center',
  },
  {
    title: '是否通过',
    dataIndex: 'status',
    width: 80,
    customRender: ({ record }) => {
      const status = record.status;
      const enable = ~~status === 1;
      const color = enable ? 'green' : 'red';
      const text = enable ? '已通过' : '待审批';
      return h(Tag, { color: color }, () => text);
    },
  },
  {
    title: '申请时间',
    dataIndex: 'create_time',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'fname',
    label: '教师名称',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'fnumber',
    label: '员工号',
    component: 'Input',
    colProps: { span: 8 },
  },
  {
    field: 'status',
    label: '审批状态',
    component: 'Select',
    componentProps: {
      options: [
        { label: '待审批', value: 0 },
        { label: '已通过', value: 1 },
      ],
    },
    colProps: { span: 8 },
  },
];

//新增弹窗form字段
export const formSchema: FormSchema[] = [
  {
    field: 'jxks_full_mark',
    label: '教学课时达标分数',
    component: 'InputNumber',
    labelWidth: '170px',
    defaultValue: 0,
    show: true,
    required: true,
  },
  {
    field: 'jkyjf_full_mark',
    label: '教科研达标分数',
    component: 'InputNumber',
    labelWidth: '170px',
    defaultValue: 0,
    show: true,
    required: true,
  },
  {
    field: 'jkyjsjf_full_mark',
    label: '教科研建设达标分数',
    labelWidth: '170px',
    component: 'InputNumber',
    defaultValue: 0,
    show: true,
    required: true,
  },
  {
    field: 'glyggfwjf_full_mark',
    label: '管理与公共服务达标分数',
    labelWidth: '170px',
    component: 'InputNumber',
    defaultValue: 0,
    show: true,
    required: true,
  }
];
